import {Component, OnInit} from "@angular/core";
import {Page} from "../../../public/util/page";
import {PlatformService} from "../platform.service";
import {States} from "../../../public/setting/enums";
import {SettingUrl} from "../../../public/setting/setting_url";
import {Util} from '../../../public/util/util';

@Component({
  selector: 'app-platform-log-list',
  templateUrl: './platform-log-list.component.html',
  styleUrls: ['./platform-log-list.component.scss']
})
export class PlatformLogListComponent implements OnInit {
  public searchParams: any = {};//搜索参数
  public platformLogList: Page = new Page(); //供应商
  public _loading: boolean = false;
  public routerLinks = SettingUrl.ROUTERLINK;//路由
  public states = States;       // 状态

  constructor(private platformService: PlatformService) {
  }

  ngOnInit() {
    this.queryPlatformLogList()
  }

  /**
   * 查询platformLog列表
   * @param curPage 当前页
   */
  queryPlatformLogList(curPage?: number) {
    this._loading = true;
    if (curPage) this.platformLogList.curPage = curPage;//当有页码时，查询该页数据
    this.platformLogList.params = {
      curPage: this.platformLogList.curPage, //目标页码
      pageSize: this.platformLogList.pageSize, //每页条数
      createTimeBegin: this.searchParams.createTimeBegin, //开始时间
      createTimeEnd: this.searchParams.createTimeEnd, //结束时间
    };
    this.platformService.getPlatformLogList(this.platformLogList.params).then((res: Page) => {
      this._loading = false;
      this.platformLogList = res;
    }).catch(err => {
      this._loading = false;
    })
  }
}
